<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item>首页</el-breadcrumb-item>
      <el-breadcrumb-item>我的留言</el-breadcrumb-item>
    </el-breadcrumb>
    <el-table
      size="small"
      :data="listData"
      highlight-current-row
      v-loading="loading"
      border
      element-loading-text="拼命加载中"
      style="width: 100%; margin-top: 15px;"
    >
      <el-table-column align="center" prop="area" label="留言时间" width="180">
        <template slot-scope="scope">
          {{ scope.row.sendTime|timestampToTime }}
        </template>
      </el-table-column>
      <el-table-column align="center" prop="sender.realName" label="留言者" width="150">
      </el-table-column>
      <el-table-column align="center" prop="content" label="留言内容" show-overflow-tooltip></el-table-column>
      
      <!-- <el-table-column align="center" label="操作">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="primary"
            icon="el-icon-edit"
            @click="handleEdit(scope.$index, scope.row)"
            >修改</el-button
          >
          <el-button size="mini" type="danger" @click="offShelf(scope.$index, scope.row, -1)" icon="el-icon-lock" v-if="scope.row.isDelete == 0">隐藏</el-button>
          <el-button size="mini" type="success" @click="offShelf(scope.$index, scope.row, 0)" icon="el-icon-check" v-else>恢复</el-button>
        </template>
      </el-table-column> -->
    </el-table>
    <!-- 分页组件 -->
    <Pagination
      v-bind:child-msg="pageparm"
      @callFather="callFather"
    ></Pagination>
  </div>
</template>

<script>
import Pagination from "../../components/Pagination.vue";
import { GetPoorMessage } from '@/api/api.js'

export default {
  data() {
    return {
      nshow: true, //switch开启
      fshow: false, //switch关闭
      loading: false, //是显示加载
      editFormVisible: false, //控制编辑页面显示与隐藏
      detailVisible: false, //详情对话框显示与隐藏
      title: "添加",
      editForm: {
        categoryId: '',
        shortDesc: '',
        name: '',
        isDelete: 0,
        pic: ''
      },
      files: {},
      photos: [],
      // rules表单验证
      rules: {
        type: [{ required: true, message: "请输入", trigger: "blur" }],
        shortDesc: [{ required: true, message: "请输入", trigger: "blur" }],
        name: [{ required: true, message: "请输入", trigger: "blur" }],
        validatNo: [{ required: true, message: "请输入", trigger: "blur" }],
        projectNo: [{ required: true, message: "请输入", trigger: "blur" }],
      },
      formInline: {
        kw: "",
        currentPage: 1,
        pageSize: 10,
      },
      listData: [], //列表数据
      // 分页参数
      pageparm: {
        currentPage: 1,
        pageSize: 10,
        total: 10,
      },
      fullscreenLoading: false,
    };
  },
  // 注册组件
  components: {
    Pagination,
  },
  /**
   * 数据发生改变
   */

  /**
   * 创建完毕
   */
  created() {
    this.getdata(this.formInline)
  },

  /**
   * 里面的方法只有被调用才会执行
   */
  methods: {
    // 获取获奖列表
    getdata(parameter) {
      this.loading = true;
      GetPoorMessage(parameter)
        .then((res) => {
          this.loading = false;
          if (res.success) {
            this.listData = res.data.records;
            this.pageparm.currentPage = res.data.currentPage;
            this.pageparm.pageSize = res.data.pageSize;
            this.pageparm.total = res.data.totalrecord;
          } else {
            this.$message({
              type: "info",
              message: res.msg,
            });
          }
        })
        .catch((err) => {
          this.editFormVisible = false;
          this.loading = false;
          this.$message.error("获取数据失败，请稍后再试！");
        });
    },
    // 分页插件事件
    callFather(parm) {
      this.formInline.currentPage = parm.currentPage;
      this.formInline.pageSize = parm.pageSize;
      this.formInline.total = parm.total
      this.getdata(this.formInline);
    },
    // 搜索事件
    search() {
      this.getdata(this.formInline);
    },
    //显示编辑界面
    handleEdit: function (index, row) {
      this.editFormVisible = true;
      if (row != undefined && row != "undefined") {
        this.title = "修改类型信息";
        this.editForm.categoryId = row.categoryId
        this.editForm.shortDesc = row.shortDesc
        this.editForm.name = row.name
        this.editForm.isDelete = row.isDelete
      } else {
        this.title = "添加分类";
        this.editForm.categoryId = null
        this.editForm.shortDesc = ""
        this.editForm.name = ""
        this.editForm.isDelete = 0
      }
    },
    
    //显示编辑界面
    handleDetail: function (index, row) {
      this.detailVisible = true
      this.currDetailData = row
      this.currDetailPics = row.pics.split(",")
    },
    // 关闭编辑、增加弹出框
    closeDialog() {
      this.editFormVisible = false;
    },
    closeDialog2() {
      this.detailVisible = false;
    },
    // 删除图片
    handleRemoveLogo(file){
      this.editForm.pic=''
      console.log('移除商品主图！',this.editForm.pic)
    },
  },
};
</script>

<style scoped>
.user-search {
  margin-top: 20px;
}
.userRole {
  width: 100%;
}
.avatar-uploader /deep/ .el-upload {
    border-radius: 6px;
    background-color: #fff;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    width: 100%;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #c33534;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    border: 1px dashed #8c939d;
    width: 180px;
    height: 140px;
    line-height: 140px;
    text-align: center;
  }
  .showUploader /deep/ .el-upload-list{
    display: none;
  }
  .avatar {
    width: 100%;
    height: 140px;
    display: block;
  }
  .img-list{
    width: 100%;
    display: flex;
    flex-wrap: wrap;
  }
  .img-list .img-li{
    display: inline-block;
    margin-right: 1%;
    width: 32%;
    margin-bottom: 5px;
  }
  .demo-image{
    margin-top: 15px;
  }
  .quill-editor {
    height: 250px;
    margin-bottom: 100px;
  }
  .logo-remove{
    cursor: pointer;
  }
</style>

 
 